package com.qfedu.ssm.controllers;

import com.qfedu.ssm.services.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserServiceImpl userService;
    @RequestMapping("/login.do")
    public String login(String userName, String userPwd, Model model){
        System.out.println("进来了");
        System.out.println("------->"+userName+userPwd);

        try {
            userService.checkLogin(userName,userPwd);
        } catch (Exception e) {
            model.addAttribute("tips","账号或密码错误");
            e.printStackTrace();
            return "/login.jsp";
        }
        return "/index.jsp";
    }
}
